# coding: utf-8

'''
    >>> a = C(7)
    >>> a.x
    7
    >>> a.x = 10
    Traceback (most recent call last):
        ...
    AttributeError: can't set attribute
    >>> a.y = 7
    >>> a.y
    7
    >>> a.y = -3
    >>> a.y
    0
    
    
'''
class C(object):
    def __init__(self, x, y=0):
        self.__x = x
        self.__y = y

    @property
    def x(self):
        return self.__x
          
    def gety(self):    
        return self.__y
    def sety(self, valor):    
        self.__y = valor if valor > 0 else 0
    @property    
    def area(self):
        return self.x * self.y
    def nem(self):
        raise AttributeError('nao toque!!!')

    y = property(nem , sety)    

if __name__=='__main__':
    import doctest
    print doctest.testmod()


